/****************************************************
 * Description: Entity for 用户组角色
 * Copyright:   Copyright (c) 2013
 * Company:     beiwaionline
 * @author      bfsu
 * @version     1.0
 * @see
	HISTORY
    *  2013-08-08 bfsu Create File
**************************************************/

package com.bfsuol.bfsuolframework.security.dao;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.bfsuol.bfsuolframework.core.entity.Entity;
import com.bfsuol.bfsuolframework.core.entity.EntitySupport;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@TableName("t_sec_group_role")
@Accessors(chain = true)
public class GroupRole extends EntitySupport implements Entity {

    private static final long serialVersionUID = 1L;

    public GroupRole(){}
    public GroupRole(Long id){
        this.id = id;
    }

    @TableId(type = IdType.AUTO,value = "group_role_id")
    private Long id;
    @TableField(exist = false)
    private Group group;//用户组
    @TableField(exist = false)
    private Role role;//角色
    @TableField(value = "is_default")
    private Integer isDefault;//默认角色
    @TableField(value = "group_id")
    private Long groupId;
    @TableField(value = "role_id")
    private Long roleId;

    public boolean isNew() {
        return getId() == null || getId().longValue()<=0;
    }
}

